package wrapper;

public class IntegerDemo {
    public static void main(String[] args) {
        /*
        Integer i1 = new Integer(5);
        Integer i2 = new Integer(5);
        System.out.println(i1 == i2);//false
        System.out.println(i1.equals(i2));//true

        Integer i3 = Integer.valueOf(5);//valueOf() 方法会缓存[-128,127]之间的值
        Integer i4 = Integer.valueOf(5);
        System.out.println(i3 == i4);//true
        System.out.println(i3.equals(i4));//true

        Integer i = Integer.valueOf(5);
        int j = i.intValue();

         */
        /*

        //自动装箱特性、、基本类刀到包装类
        Integer i = 5;
        //自动拆箱特性、
        int j = i;

         */

        //包i妆泪的额常用操作
        //1获取基本类型的取值范围
        int max = Integer.MAX_VALUE;
        int min = Integer.MIN_VALUE;
        System.out.println("int的最大值为："+max+" ,最小值为"+min);
        long max1 = Long.MAX_VALUE;
        long min1 = Long.MIN_VALUE;
        System.out.println("long的最大值为："+max1+" ,最小值为"+min1);

        //2)包装类可以将 字符串转换为对应的基本类型
        String s1 = "40";
        int age = Integer.parseInt(s1);
        System.out.println(age);

        String s2 = "3.14";
        double d = Double.parseDouble(s2);
        System.out.println( d);




    }
}
